home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / PCI Driver Development Kit / • Samples / Open Firmware Samples / Minimal sample / NCR.of < prev    next >
Encoding:
Text File  |  1996-11-14  |  3.8 KB  |  98 lines  |  [TEXT/MPS ]

  1.  
  2. \ Open Firmware FCode driver for the NCR 8250S PCI-SCSI Card
  3. \
  4. \ by Monte Benaresh -- February 13, 1995
  5. \
  6. \ Copyright:    © 1994-1995 by Apple Computer, Inc., all rights reserved.
  7. \
  8.  
  9.  
  10. \ This is a minimal FCode driver which simply provides identifying information
  11. \ in its device node, and creates a property in its device node which contains
  12. \ the runtime driver to be loaded into the Mac system heap by the Expansion Bus
  13. \ Manager.
  14.  
  15. \ push arguments on the stack for pci-header:
  16. \    *** THESE MUST MATCH THE CONFIG REGISTERS FOR YOUR    ***
  17. \    *** FCODE TO BE RECOGNIZED BY OPEN FIRMWARE            ***
  18. \    vendor #, device #, class-code = SCSI bus controller
  19.  
  20. tokenizer[  hex  1000 0003 010000  decimal ]tokenizer
  21. pci-header                \ generate proper PCI image header
  22.  
  23.     fcode-version2        \ generate proper FCode header (within PCI image)
  24.  
  25.  
  26.     " AAPL,NCR8250S" device-name                        \ Apple is card vendor
  27.     " scsi" device-type
  28.     " 8250S" model
  29.  
  30. \ generate a "reg" property which lists our configuration space at the start of
  31. \ our assigned space, with 0 size (as required by the PCI Binding Supplement)
  32.  
  33.     0 0 my-space encode-phys
  34.         0 encode-int 0 encode-int encode+ encode+                    \ config space
  35.  
  36. \ The next entry is for the onboard ROM memory space, and is necessary to
  37. \ support if you are using encode-file to encapsulate your runtime
  38. \ driver in a driver-reg property.
  39.  
  40.     0 0 my-space h# 02000030 or encode-phys
  41.         0 encode-int h# 00008000 encode-int encode+ encode+            \ ROM space
  42.         encode+
  43.     0 0 my-space h# 02000014 or encode-phys
  44.         0 encode-int h# 00000100 encode-int encode+ encode+            \ memory space
  45.         encode+ " reg" property
  46.  
  47. \ generate a "power-consumtion" property which lists standby and full-on power
  48. \ consumtion for various power rails in microwatts; if we don't create this
  49. \ property, Open Firmware will create one by filling in the "unspecified" rail
  50. \ entries from the PRSNT pins (since we know our power consumption, we fill the
  51. \ "unspecified" entries with zeros)
  52.  
  53.     0 encode-int 0 encode-int encode+                                \ "unspecified"
  54.     d# 7500000 encode-int d# 7500000 encode-int encode+ encode+        \ +5V
  55.     0 encode-int 0 encode-int encode+ encode+                        \ +3V
  56.     d# 8100000 encode-int d# 8100000 encode-int encode+ encode+        \ I/O power
  57.     \ remaining entries are 0 and can be omitted
  58.     \ 0 encode-int 0 encode-int encode+ encode+                        \ reserved
  59.     " power-consumption" property
  60.  
  61.  
  62. \ the following properties will be automatically generated for this card:
  63. \    "has-fcode"
  64. \    "vendor-id" - from PCI configuration register
  65. \    "device-id" - from PCI configuration register
  66. \    "revision-id" - from PCI configuration register
  67. \    "class-code" - from PCI configuration register
  68. \    "interrupts" - from PCI configuration register
  69. \    "min-grant" - from PCI configuration register
  70. \    "max-latency" - from PCI configuration register
  71. \    "devsel-speed" - from PCI configuration register
  72. \    "fast-back-to-back" - from PCI configuration register
  73. \    "assigned-addresses"
  74.  
  75. \ we don't need to define any methods here; there is enough information for the
  76. \ runtime driver to be able to locate the card, but a complete FCode implementation
  77. \ would provide boot-time I/O services
  78.  
  79.  
  80. \ include an image of the runtime driver, and have it assigned as the value of a
  81. \ property that the Expansion Bus Manager will read at startup
  82.  
  83. \ the name of the property takes the form, "driver-reg,<company>,<osname>,<isa>"
  84. \ NOTE:    in the following example, the given <osname> (for Macintosh System 7)
  85. \        is preliminary and subject to change
  86.  
  87. \ use encode-file to create a driver… property, which saves space in
  88. \ copies of the device tree that an OS may keep because it contains a pointer to
  89. \ your driver that the OS can use to find the image and copy if from your
  90. \ onboard ROM
  91.  
  92. \ encode-file is now supported in the A7 Mac ROM
  93.     encode-file NCRDriver   " driver,AAPL,MacOS,PowerPC" property
  94.  
  95.  
  96.     fcode-end            \ terminate normal FCode
  97. pci-end                    \ complete the PCI image
  98.